package edu.qd.learn.newchapter.chapter05.stream;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author 布衣
 */
public class EmployeeData {

    private List<Employee> emps = new ArrayList<>();

    private AtomicInteger index = new AtomicInteger(0);

    private int increment(){
        return index.getAndIncrement();
    }

    /**
     * 入职
     *
     * @param emp 员工信息
     */
    public void add(Employee emp) {
        emp.setEno(increment());
        this.emps.add(emp);
    }


    /**
     * 获取全部员工信息
     *
     * @return
     */
    public List<Employee> getEmps() {
        return emps;
    }

}
